import { defineStore } from "pinia";
import { useSessionStorage } from "@vueuse/core";

interface BehaviorStore {
  data: Record<string, any>;
}

const behaviorStorage = useSessionStorage("behavior", {});
export const useBehavior = defineStore("behavior", {
  state: (): BehaviorStore => ({
    data: behaviorStorage.value,
  }),
  actions: {
    setData(data: Record<string, any>) {
      this.data = data;
      behaviorStorage.value = data;
    },
  },
});
